"""
Description :  
Author :       songtao
date：         2023/2/6
"""
import sys

from omegaconf import OmegaConf

from zs_config.common import GenericLoader


class CmdlineConfigLoader(GenericLoader):
    def load(self):
        args = sys.argv[1:]
        overrides = [i for i in args if (not i.startswith('-')) and ('=' in i)]
        cmdline_conf = OmegaConf.create()
        cmdline_conf.merge_with_dotlist(overrides)
        return [{'id': "CommandLine", 'obj': cmdline_conf}]


if __name__ == '__main__':
    print(CmdlineConfigLoader().load())
